import React, { useEffect, useState } from 'react'
import { getMessageList } from '../api/message'

export default function Message() {
    const [messageList, setMessageList] = useState([])
    useEffect(() => {
        (async () => {
            const message = await getMessageList()
            setMessageList(message)
        }
        )()
    }, [])
    return (
        <div>
            <ul>
                {
                    messageList.map((item) => {
                        return (
                            <li key={item.id}>
                                <a href="/home/message/1">{item.title}</a> &nbsp;&nbsp;
                                <button>push</button> &nbsp;
                                <button>replace</button>
                            </li>
                        )
                    })
                }
            </ul>
            <button>前进</button>
            <button>后退</button>
        </div>
    )
}
